package com.bw.zg5_demo_2.adpter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.bw.zg5_demo_2.ui.MainActivity;

import java.util.List;

public class MainViewPagerAdapter extends FragmentStateAdapter {
    List<Fragment> fragmentList;

    public MainViewPagerAdapter(@NonNull FragmentActivity fragment, List<Fragment> list) {
        super(fragment);
        this.fragmentList=list;
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getItemCount() {
        return fragmentList.size();
    }
}
